<template>
	<view class="content columnbox wdh-100">
		<view class="rowbox wdh-100 spb one-info" @click="showDocument('1819715987878191106','用户协议')">
			<view>用户协议</view>
			<u-icon name="arrow-right" size="28rpx"></u-icon>
		</view>
		<view class="rowbox wdh-100 spb one-info" @click="showDocument('1819716086612107266','隐私协议')">
			<view>隐私协议</view>
			<u-icon name="arrow-right" size="28rpx"></u-icon>
		</view>
		<view class="rowbox wdh-100 spb one-info" @click="showDocument('1819715684705509378','关于我们')">
			<view>关于我们</view>
			<u-icon name="arrow-right" size="28rpx"></u-icon>
		</view>
		<view class="rowbox wdh-100 spb one-info" @click="showSet">
			<view>订阅消息</view>
			<u-icon name="arrow-right" size="28rpx"></u-icon>
		</view>
		<!-- <view class="rowbox wdh-100 spb one-info">
			<view>帐号注销</view>
			<u-icon name="arrow-right" size="28rpx"></u-icon>
		</view> -->
		<view v-if="isLogin" @click="quitLog" class="quit-btn rowbox">退出登录</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {

			};
		},
		computed: {
			// 通过计算属性将 state 中的 count 映射到组件
			isLogin() {
				return this.$store.state.isLogin;
			},
			userInfo() {
				return this.$store.state.user;
			},
		},
		methods: {
			showSet() {
				wx.openSetting({
					success: res => {}
				})
			},
			showDocument(id, name) {
				uni.navigateTo({
					url: `/packageA/document/document?id=${id}&name=${name}`
				})
			},
			quitLog() {
				uni.clearStorageSync()
				this.$store.dispatch('actionsHandleUserInfoChange', '');
				this.$store.dispatch('actionsHandleIsLoginChange', false);
				this.$store.dispatch('actionsHandleTokenChange', '');

				uni.switchTab({
					url: '/pages/index/index'
				})
			},
		}
	}
</script>


<style lang="scss" scoped>
	.content {
		background: #f1f4f4;
		min-height: 100vh;
		justify-content: flex-start;
		font-family: PingFang SC;
	}

	.one-info {
		background: #fff;
		padding: 32rpx;
		border-bottom: #f1f4f4 solid 1px;
		font-size: 28rpx;
	}

	.quit-btn {
		font-size: 28rpx;
		width: 600rpx;
		border: #17698F solid 1px;
		height: 90rpx;
		color: #fff;
		background: #17698F;
		border-radius: 10rpx;
		margin-top: 40rpx;
	}
</style>